﻿using System;
using System.Text;
using IAM.Interface.Model;
using System.Xml;
using IAM.Interface.ModelExample;

namespace ResponseLocalLibrary
{
    /// <summary>
    /// 此类中的方法由各系统自己实现
    /// </summary>
    public class Business
    {
        public enum Prefix_Dimension
        {
            Role = 0,
            ASBOrLucent = 1,
            Comment = 2,
            Download = 3,
            CAT = 4,
            BD = 5,
            Province = 6

        }

        public static void CreateLog(BEGDC.PreContract.BLL.OperationLog.OperationType operationtype, string logcontent, string employeename)
        {
            try
            {
                BEGDC.PreContract.DAL.OperationLog log = new BEGDC.PreContract.DAL.OperationLog();

                log.OperationType = operationtype.ToString();

                log.LogContent = logcontent;

                log.OperationDate = System.DateTime.Now;

                log.EmployeeName = employeename;

                log.HostName = System.Web.HttpContext.Current.Request.UserHostName;

                log.HostIP = System.Web.HttpContext.Current.Request.UserHostAddress;

                log.Create();
            }
            catch { }

        }

        #region 人员权限管理成员方法
        /// <summary>
        /// 获取权限模型
        /// </summary>
        /// <returns>所有的权限模型</returns>
        public ACMMode GetACIModel()
        {
            ACIManagement acimgnt = new ACIManagement();
            return acimgnt.GetACIModel();
        }
        /// <summary>
        /// 获取用户权限信息
        /// </summary>
        /// <param name="accountinfo">人员帐号信息</param>
        /// <returns>用户的权限信息</returns>
        public ACI GetUserACI(AccountInfo accountinfo)
        {
            ACIManagement acimgnt = new ACIManagement();
            return acimgnt.GetUserACI(accountinfo);
        }
        /// <summary>
        /// 设置用户权限信息
        /// </summary>
        /// <param name="acisessions">用户的权限信息</param>
        /// <returns>设置后用户权限信息</returns>
        public ACI SetUserACI(ACI aci)
        {
            ACIManagement acimgnt = new ACIManagement();
            return acimgnt.SetUserACI(aci);
        }
        #endregion
        #region 代理管理方法
        /// <summary>
        /// 获取可代理模块列表
        /// </summary>
        /// <returns>可以进行代理设置的模块列表</returns>
        public Modules GetModuleList()
        {
            DelegationMagagement acimgnt = new DelegationMagagement();
            return acimgnt.GetModuleList();
        }
        /// <summary>
        /// 获取用户代理信息
        /// </summary>
        /// <param name="accountinfo">人员帐号信息</param>
        /// <returns>代理设置信息列表</returns>
        public AIDelegations GetDelegationInfo(AccountInfo accountinfo)
        {
            DelegationMagagement acimgnt = new DelegationMagagement();
            return acimgnt.GetDelegationInfo(accountinfo);
        }
        /// <summary>
        /// 设置用户代理信息
        /// </summary>
        /// <param name="aidelegations">用户代理信息</param>
        /// <returns>设置后的用户代理信息</returns>
        public AIDelegations SetDelegationInfo(AIDelegations aidelegations)
        {
            DelegationMagagement acimgnt = new DelegationMagagement();
            return acimgnt.SetDelegationInfo(aidelegations);
        }
        #endregion
        #region  身份信息管理成员方法
        /// <summary>
        /// 创建用户
        /// </summary>
        /// <param name="xmlrequest"></param>
        /// <returns></returns>
        public virtual AccountInfo CreateIdentity(Identity xmlrequest)
        {
            IdentityManagement business = new IdentityManagement();
            return business.CreateIdentity(xmlrequest);

        }
        /// <summary>
        /// 激活用户
        /// </summary>
        /// <param name="xmlrequest"></param>
        /// <returns></returns>
        public virtual AccountInfo EnableIdentity(Identity xmlrequest)
        {
            IdentityManagement business = new IdentityManagement();
            return business.EnableIdentity(xmlrequest);
        }
        /// <summary>
        /// 禁用用户
        /// </summary>
        /// <param name="xmlrequest"></param>
        /// <returns></returns>
        public virtual AccountInfo DisableIdentity(Identity xmlrequest)
        {
            IdentityManagement business = new IdentityManagement();
            return business.DisableIdentity(xmlrequest);
        }
        /// <summary>
        /// 删除用户
        /// </summary>
        /// <param name="xmlrequest"></param>
        /// <returns></returns>
        public virtual AccountInfo DeleteIdentity(Identity xmlrequest)
        {
            IdentityManagement business = new IdentityManagement();
            return business.DeleteIdentity(xmlrequest);

        }
        /// <summary>
        /// 更新用户信息
        /// </summary>
        /// <param name="xmlrequest"></param>
        /// <returns></returns>
        public virtual AccountInfo UpdateIdentity(Identity xmlrequest)
        {
            IdentityManagement business = new IdentityManagement();
            return business.UpdateIdentity(xmlrequest);

        }
        #endregion  成员方法
        #region 组织信息管理方法
        /// <summary>
        /// 组织信息更新
        /// </summary>
        /// <param name="organizeinfo">组织机构信息,包括机构基本信息和主管人员信息</param>
        /// <returns>成功/失败</returns>
        public bool UpdateOrganize(OrganizeInfo organizeinfo)
        {
            OrganizationManagement business = new OrganizationManagement();
            return business.UpdateOrganize(organizeinfo);
        }
        /// <summary>
        /// 组织机构创立
        /// </summary>
        /// <param name="organizeinfo">组织机构信息,包括机构基本信息和主管人员信息</param>
        /// <returns>成功/失败</returns>
        public bool CreateOrganize(OrganizeInfo organizeinfo)
        {
            OrganizationManagement business = new OrganizationManagement();
            return business.CreateOrganize(organizeinfo);
        }
        /// <summary>
        /// 组织结构删除（包括合并）
        /// </summary>
        /// <param name="organizedeleteparameter">组织结构删除 组织机构信息</param>
        /// <returns>成功/失败</returns>
        public bool DeleteOrganize(OrganizeDeleteParameter organizedeleteparameter)
        {
            OrganizationManagement business = new OrganizationManagement();
            return business.DeleteOrganize(organizedeleteparameter);
        }
        #endregion
    }
}
